Notes for NTSC-U version of Parasite Eve

------------------------------------

CD1 and CD2 same SLUS and PE.IMG files

------------------------------------

PE.IMG data structure

SLUS_006 - headers
PE_H0.bin  0x838D4  0x8397C  (contain game 'System/Misc' data)
PE_H1.bin  0x8397C  0x83B78  (contain only AKAOs)
PE_H2.bin  0x83B78  0x84980

first and second header (type 1 header)
Pos Size  Description
0   4B    base pointer (this is added to each pointer)
4   2B[]  array of pointers to data (from base pointer, in sectors)
X   4B    last pointer (size of block for this header)

third header (type 2 header)
0   8B[]  array of info block (Type 2 header element)

Third header element
0   4B    pointer to block (in sectors)
4   1B    size of first file (in sectors) (usualy 0x21, but was 0x11 too) (F1)
5   12b   size of second file (in sectors)  (F2)
6+  12b   size of third file * 0x10 (in sectors) (F3)


Type 2 header - F1, F2, F3 are 'db' files
F1 contain only 9th header elements
F2 contain only 9th header elements
F3 can contain all excepth 9th header elements? (some contain all, some less)

(F3 with all except 9t, 2_004_2)
------------------------------------

Structures of files in PE.IMG

'db' file (naming as data blocks, database...)
0   4B      Size of this 'file' (FS)
0   4B      Pointer to header from Block Start (PH)
8B  PH-8B   Data
PH  FS-PH   Header
    

Header:
0   4B      ID? more parts?
4B  4B[12]  pointer to header block PHB

PHB format
0   22bit   Pointer to header data (pointer from file start)
0   10bit   number of files (subblocks) in this block

Header data format (header block), not constant size?
0   3B      data block size(DS)
4   1B      unkwn1  (value 0x1, 0x10, 0x20, ...?)
4   3B      pointer to data from file start (DP), pointer is dividable by 4 (4B size align)
7   1B      unkwn2  (value varies)
8   2B      dunno1; differ for headers? (D1)
10  2B      dunno2; differ for headers? ID sometimes? (D2)
12  8B      for header data in 9th header

- standard size is 12Bytes, some have 8B and some 20B

0th to 11th header data element blocks (12 header blocks)
0-3th, Ath, Bth  have size of header element 12B
4-8th have 8B size (have only start, size and U1, U2)
8th weird? not a data as below? (zero size, start pointer sometimes exceed fileSize, weird pointers)
9th has 20byte element size, but those 8B more are always zero?
    - D1 and D2 looks like something to graphic for loading to PSX VRAM?
      (graphic parts are splitted (first file - height 99px, second 1 pixel(togather h 256px), next looks like to go next/under first...))


Pointers are ususaly aligned to 4B (unused place filed with zeros)

In header data are 'optimalization'? - reuse of data in header

2_000_2 : size 0x000288C4, header start  0x00028698 (166084, 165528)
 Header Data 3 : 0x286F0  0x020 (start, count): element size C
        Size  U1  Start U2 Duh? Duh?
...
  08 :    434  0  135FC  2    0  200 
...
  0F :    588  0  16B08  1    0  300 
  10 :    434  0  135FC  2    0  300  -> pointer to already pointed data -> reuse of data
  11 :    AC4  0  17090  3    0  300  -> this position is 0Fth postion + size
...

duplicities are usualy within one header data type,
but in case of A and B (both AKAO) once happened 'inter'(file 2_031_2)

------------------------------------



------------------------------------
------------------------------------
------------------------------------
Chaos notes


3 dirs
0th - base (mixed)
1st - AKAOs (only AKAO)
2nd - backgrounds? (structured files)

in mem starts at 0x800930D4 ?

header in 0x838DA in SLUS  2B per file...which is max 134 215 680 bytes...
size 0xA0 bytes?
0x838D4 to 0x8397C = 0xA8 = 168 ~ 0x50 elementu = 80 elementu
00 00 00 00
00 00 47 00 48 00 57 00 79 00 7E 00 83 00 99 00 
9C 00 9D 00 B4 00 C5 00 C8 00 CB 00 DC 00 ED 00 
FE 00 0F 01 20 01 3C 01 54 01 70 01 8C 01 AC 01 
B2 01 BA 01 C0 01 C8 01 D0 01 D8 01 DE 01 E3 01 
E9 01 F1 01 F7 01 FE 01 07 02 0E 02 14 02 19 02 
1B 02 1D 02 20 02 23 02 26 02 29 02 3A 02 4B 02 
5C 02 6D 02 7E 02 8F 02 A0 02 B1 02 C2 02 D3 02 
E4 02 F5 02 06 03 17 03 28 03 39 03 4A 03 5B 03 
6C 03 7D 03 8E 03 9F 03 C5 03 C9 03 D2 03 57 04 
FC 04 16 05 0B 06 00 07 B7 07 E0 07 39 08 9D 08
(after this are bytes with 0x000008B0, 0x000008B0, )
(next header, but shifted? continuing of header?)
B0 08 00 00   (can be to last? size in sectors?)

0x8397C to 0x83B78  (0x1FC = 508 bytes ~ 0xFA elementu = 250 elementu... lower, some are same)
B0 08 00 00   (base for next ...500Bytes...)
00 00 16 00 25 00 2E 00 3C 00 46 00 53 00 66 00  (500 bytes size ??)
41 1A 00 00   (last, size mark?)

0x1A41 + 0x8B0 = 0x22F1  (last + base = next 4 bytes (data after header))
replaced 201 AKAO (= contain 201 AKAOs = number of unique files (pointers))
(from PE.IMG)
0x458000  0x8B0  0x00    AKAO
0x463000  0x8C6  0x16    AKAO
0x46A800  0x8D5  0x25    AKAO
...
0x1172000 0x22E4 0x1A34  AKAO

next bytes in SLUS  ( 0x83B78 to 0x84980 = 0xE08 = 3592B ~ 898 elementu... lower, some are same (828 unique))
F1 22 00 00 21 4A 20 05 
AE 23 00 00 21 39 30 04 
4B 24 00 00 21 7A 60 04 
2C 25 00 00 21 BA 30 06
...
52 89 01 00 00 00 00 00  = 0xC4A9000 in PE.IMG = PE.IMG size... 

0x1178800  0x22F1   next ... 8C 00 01 00 08 00 01 00

F1 22 00 00 21 4A 20 05 
this file contais 3 files, with size 0x21*0x800, 0x4A*0x800 and SIZE - previous two files (rest)
20 05 ? ID? Nope! Neear header end 3 with same 30 06 next each other...
(there are same values, but they are next each other? one group? have same whole 4 bytes (not pointer))
(sometimes not same with teh same 2 bytes (80 01))

(header element size) (pos from 0)
Poistion  PosInSectors  Type
0                   TIM - menu background tim
0x23800   0x47      change disk texts, no header?
0x24000   0x48      structures in structures...    items...?
0x2B800   0x57      teh header... 50 0A 01 00 BC 09 01 00  (12Bytes) (pos 1th) (?? graphic?)
0x3C800   0x79      next ...   78 24 00 00 08 24 00 00
0x3F000   0x7E      next ...   50 20 00 00 08 20 00 00
0x41800   0x83      AKAO
0x4C800   0x99      next ...   E8 13 00 00 90 10 00 00 - groups of AKAO  (12Bytes) (pos 10th)
0x4E000   0x9C      AKAO
0x4E800   0x9D      next ...   BC B6 00 00 78 B5 00 00
0x5A000   0xB4      TIM (04b_0002.tim  3rd tim in file...) - fonts
0x62800   0xC5      TIM (04b_0003.tim  4th) - battle text / numbers
0x64000             next ...   FC 15 00 00 A4 15 00 00 (12Bytes) (pos 1th)  (AKAOs?)
0x65800             next ...   78 84 00 00 08 84 00 00 ... weird header, weird element size...(20Bytes) (pos 9th)
0x6E000             next ...   78 84 00 00 08 84 00 00 ... weird header, weird element size...(20Bytes) (pos 9th)
0x76800   0xED      next ...   78 84 00 00 08 84 00 00 ...
...
More reseaarch on: 
0x4C800              next ...   E8 13 00 00 90 10 00 00 - groups of AKAO (easy find starts...:P?!)
                        - Sizes 0x10, 0x10, 0x14, 0x14, 0x14, 0x48, 0x60, ....
At Block start is 
0   4B      Size of this 'file' (FS)
0   4B      Pointer to header from Block Start (PH)
8B  PH-8B   Data
PH  FS-PH   Header
    

Header:
13 x header block? - 1x 0(base?), 11x data types? 1x pointer to end..?
XX XX YX YY  XXXXX = pointer to header data from ALLBASE, YYY number of files... * 4?
00 00 00 00 
C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 C4 10 00 00 
C4 10 C0 10 
E8 13 00 00 

(C0 00 = 3  entries * 4? or using only Hi nibble?)
(C0 10 = 67 entries * 4? or using only Hi nibble?)
 = > 
0x43 = 67 entries
Element size = 12Bytes
Data Size   DataPointer Dunno ID ??
10 00 00 00 08 00 00 00 01 00 6A 04 
10 00 00 00 18 00 00 00 01 00 6B 04 
14 00 00 00 28 00 00 00 01 00 6C 04 
14 00 00 00 3C 00 00 00 01 00 6D 04 
14 00 00 00 50 00 00 00 01 00 6E 04 
48 00 00 00 64 00 00 00 01 00 80 04 
60 00 00 00 AC 00 00 00 01 00 81 04
48 00 00 00 64 00 00 00 01 00 82 04 
60 00 00 00 AC 00 00 00 01 00 83 04 
48 00 00 00 64 00 00 00 01 00 84 04 60 00 00 00 AC 00 00 00 01 00 85 04 48 00 00 00 0C 01 00 00 01 00 86 04
58 00 00 00 54 01 00 00 01 00 87 04 3C 00 00 00 AC 01 00 00 01 00 88 04 84 00 00 00 E8 01 00 00 01 00 89 04
48 00 00 00 6C 02 00 00 00 00 92 04 3C 00 00 00 B4 02 00 00 00 00 93 04 40 00 00 00 F0 02 00 00 00 00 94 04
3C 00 00 00 30 03 00 00 00 00 95 04 48 00 00 00 6C 03 00 00 00 00 96 04 38 00 00 00 B4 03 00 00 00 00 97 04
4C 00 00 00 EC 03 00 00 00 00 98 04 40 00 00 00 38 04 00 00 00 00 99 04 6C 00 00 00 78 04 00 00 00 00 9A 04
4C 00 00 00 E4 04 00 00 00 00 9B 04 58 00 00 00 30 05 00 00 00 00 9C 04 68 00 00 00 88 05 00 00 00 00 9D 04
84 00 00 00 F0 05 00 00 00 00 9E 04 7C 00 00 00 74 06 00 00 00 00 9F 04 4C 00 00 00 F0 06 00 00 00 00 A0 04
58 00 00 00 3C 07 00 00 00 00 A1 04 38 00 00 00 94 07 00 00 00 00 A2 04 34 00 00 00 CC 07 00 00 00 00 A3 04
38 00 00 00 00 08 00 00 00 00 A4 04 44 00 00 00 38 08 00 00 00 00 A5 04 68 00 00 00 7C 08 00 00 00 00 A6 04
78 00 00 00 E4 08 00 00 00 00 A7 04 3C 00 00 00 5C 09 00 00 00 00 A8 04 48 00 00 00 98 09 00 00 00 00 A9 04
8C 00 00 00 E0 09 00 00 00 00 AA 04 80 00 00 00 6C 0A 00 00 00 00 AB 04 64 00 00 00 EC 0A 00 00 00 00 AC 04
44 00 00 00 50 0B 00 00 00 00 AD 04 6C 00 00 00 94 0B 00 00 00 00 AF 04 84 00 00 00 00 0C 00 00 00 00 B0 04
44 00 00 00 84 0C 00 00 00 00 B1 04 40 00 00 00 C8 0C 00 00 00 00 B2 04 4C 00 00 00 08 0D 00 00 00 00 B7 04
5C 00 00 00 54 0D 00 00 00 00 B8 04 3C 00 00 00 B0 0D 00 00 00 00 B3 04 38 00 00 00 EC 0D 00 00 00 00 B4 04
24 00 00 00 24 0E 00 00 00 00 B5 04 34 00 00 00 48 0E 00 00 00 00 B6 04 1C 00 00 00 7C 0E 00 00 00 00 4C 04
24 00 00 00 98 0E 00 00 00 00 4D 04 24 00 00 00 BC 0E 00 00 00 00 4E 04 28 00 00 00 E0 0E 00 00 00 00 4F 04
24 00 00 00 08 0F 00 00 00 00 50 04 2C 00 00 00 2C 0F 00 00 00 00 51 04 2C 00 00 00 58 0F 00 00 00 00 52 04
14 00 00 00 84 0F 00 00 00 00 53 04 34 00 00 00 98 0F 00 00 00 00 54 04 20 00 00 00 CC 0F 00 00 00 00 55 04
20 00 00 00 EC 0F 00 00 00 00 56 04 20 00 00 00 0C 10 00 00 00 00 57 04 1C 00 00 00 2C 10 00 00 00 00 58 04
48 00 00 00 48 10 00 00 00 00 5B 04 


0x65800             next ...   78 84 00 00 08 84 00 00 ... weird header, weird element size...(20Bytes) (pos 9th)

header...
00 00 00 00 
3C 84 00 00 
3C 84 00 00 3C 84 00 00 3C 84 00 00 3C 84 00 00 3C 84 00 00 3C 84 00 00 3C 84 00 00 3C 84 00 00 
3C 84 C0 00 
78 84 00 00 78 84 00 00 

80 7F 00 00 08 00 00 FF 40 00 0F 20 00 00 00 00 00 00 00 00 
00 04 00 00 88 7F 00 02 00 01 00 38 00 00 00 00 00 00 00 00 
80 00 00 00 88 83 00 01 40 00 EF 3F 00 00 00 00 00 00 00 00

